<?php
require_once ('dbconfig.php');
?>

<html>
<head>
<title>Delete Moon</title>
</head>
<body onload="CCPEVE.requestTrust('http://swamp.rokitt-web.com')">

<?php
$mode = $_GET ['mode'];
if ($mode == 1) {
	
	$moonid = $_GET ['moonId'];
	$corpName = $_GET ['corpname'];
	$systemName = $_GET ['system'];
	$planet = $_GET ['planet'];
	$moon = $_GET ['moon'];
	
	$page = "<table cellpadding=1 cellspacing=1 border=1>";
	$page .= "<tr><td><b>Corporation</b></td><td><b>System</b></td>";
	$page .= "<td><b>Planet</b></td><td><b>Moon</b></td></tr>";
	$page .= "<tr><td>$corpName</td><td>$systemName</td><td>$planet</td><td>$moon</td></tr></table>";
	$page .= "<br><input type=\"button\" value=\"Delete\" onclick=\"location.href='http://swamp.rokitt-web.com/al_tools/deleteMoon.php?moonId=$moonid&corpname=$corpName&system=$systemName&planet=$planet&moon=$moon&mode=2'\">";
	echo $page;

}

if ($mode == 2) {
	$moonid = $_GET ['moonId'];
	$mysqli = new mysqli ( DB_HOST, DB_USER, DB_PASS, DB_NAME );
	$sql = "Delete from al_taxableMoons where alTmId = $moonid";
	$mysqli->query ( $sql );
	echo "moon deleted <br>";
	echo "<a href=\"taxableMoons.php\">Back</a>";
}

?>
</body>
</html>